<?php

/**
 * @Author Xman (admin@user.vn)
 * @Website http://user.vn
 * @Description Get rows from catid
 */

$catid = 17; # cat id
$num = 2; # amount rows to get
$striptext = 100; #cutout long text
$imgwidth = 52; #image width
$imgheight = 60; #image height


global $global_config, $db, $lang_global, $site_mods, $module_file;

$sql = "SELECT id, title, alias, hometext, homeimgalt, homeimgthumb FROM `" . NV_PREFIXLANG . "_news_" . $catid . "` WHERE homeimgfile!='' AND `status`= 1 ORDER BY `publtime` DESC LIMIT 0, " . $num . "";
$result = $db->sql_query ( $sql );
$content = '<ul class="listnews">';
while ( list ( $id, $title, $alias, $hometext, $homeimgalt, $homeimgthumb ) = $db->sql_fetchrow ( $result ) ) {
	list ( $catalias ) = $db->sql_fetchrow ( $db->sql_query ( "SELECT alias FROM `" . NV_PREFIXLANG . "_news_cat` WHERE catid=" . $catid . "" ) );
	$link = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=news&amp;" . NV_OP_VARIABLE . "=" . $catalias . "/" . $alias . "-" . $id;
	$homeimgthumb = explode ( '|', $homeimgthumb );
	$imglink = NV_BASE_SITEURL . NV_FILES_DIR . '/news/' . $homeimgthumb [0];
	$hometext = strip_tags ( $hometext );
	$hometext = nv_clean60 ( $hometext, $striptext );
	$content .= '
    <li class="clearfix" style="margin:5px">
		<a title="' . $title . '" href="' . $link . '"><img src="' . $imglink . '" alt="' . $homeimgalt . '" width="' . $imgwidth . '" height="' . $imgheight . '" style="margin-right: 5px; float: left;"></a>
		<a title="' . $title . '" href="' . $link . '"><strong>' . $title . '</strong></a><br />'.$hometext.'
    </li>
	';
}
$content .= '</ul>';
?>